//
//  BindingWeChatViewController.m
//  firstpoint
//
//  Created by 泽中 on 2017/7/18.
//  Copyright © 2017年 xzcysoft. All rights reserved.
//

#import "BindingWeChatViewController.h"
#import "BinDingTextView.h"
#import "BinDingPromptView.h"
#import "PromptView.h"

@interface BindingWeChatViewController ()
{
    BinDingTextView*idTextField;
}
@end

@implementation BindingWeChatViewController
-(void)httpRequest
{
    NSString*tokenStr= OBJECT_FOR_KEY(@"token");
    NSString*urlStr=[NSString stringWithFormat:@"user/addBankInfoById.api?access_token=%@",tokenStr];
    [HTTPURL postRequest:LINK_BASE_URL(urlStr) parameters:@{@"userId":userid,@"weChat":idTextField.textField.text} success:^(NSURLSessionDataTask *task, id responseObject) {
        NSLog(@"%@",responseObject);
        [PromptView showView:responseObject[@"retInfo"] style:1];

    } filure:^(NSURLSessionDataTask *task, id error) {
        
    }];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"绑定微信";
    self.view.backgroundColor=LRRGBColor(235, 240, 242);
    [self setUI];
    // Do any additional setup after loading the view.
}
-(void)setUI
{
    UIView*view=[[UIView alloc]initWithFrame:CGRectMake(0, 74, width_screen, 110)];
    view.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:view];
    
    idTextField=[[BinDingTextView alloc]initWithFrame:CGRectMake(0, 0, width_screen, 46)];
    idTextField.textField.placeholder=@" 您的微信账号";
    idTextField.titleLab.text=@"微信号";
    [view addSubview:idTextField];
    
    BinDingPromptView*tishiView=[[BinDingPromptView alloc]initWithFrame:CGRectMake(0, 142, width_screen, 80)];
    [self.view addSubview:tishiView];
    UIButton*button=[UIButton buttonWithType:UIButtonTypeCustom];
    button.frame=CGRectMake(10, 220, width_screen-20, 50);
    button.backgroundColor=LRRGBColor(23, 146, 211);
    button.layer.cornerRadius=4;
    [button setTitle:@"确认" forState:0];
    [button addTarget:self action:@selector(buttonClick) forControlEvents:64];
    [self.view addSubview:button];
    
}
-(void)buttonClick
{
    [self httpRequest];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
